package com.demo.aty.component;

import com.binioter.guideview.MyApplication;
import com.demo.aty.ResourceTable;
import com.binioter.guideview.viewComment;

import ohos.agp.components.*;
import ohos.agp.utils.Color;
import ohos.agp.window.dialog.ToastDialog;

/**
 * Created by binIoter on 16/6/17.
 */
public class MutiComponent implements viewComment {
    @Override
    public Component getView(LayoutScatter inflater) {
        DirectionalLayout ll = new DirectionalLayout(MyApplication.getInstance());
        DirectionalLayout.LayoutConfig param = new DirectionalLayout.LayoutConfig(DirectionalLayout.LayoutConfig.MATCH_CONTENT,
                DirectionalLayout.LayoutConfig.MATCH_CONTENT);

        ll.setOrientation(Component.VERTICAL);
        ll.setLayoutConfig(param);
        Text textView = new Text(MyApplication.getInstance());
        textView.setTextColor(Color.WHITE);
        textView.setText("查看附近的人");
        textView.setTextSize(60);
        Image imageView = new Image(MyApplication.getInstance());
        imageView.setPixelMap(ResourceTable.Media_arrow);
        ll.removeAllComponents();
        ll.addComponent(textView);
        ll.addComponent(imageView);

        ll.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                new ToastDialog(MyApplication.getInstance()).setText("蒙层已被点击").show();
            }
        });
        return ll;
    }
    @Override
    public int getAnchor() {
        return viewComment.ANCHOR_BOTTOM;
    }

    @Override
    public int getFitPosition() {
        return viewComment.FIT_CENTER;
    }

    @Override
    public int getXOffset() {
        return 0;
    }

    @Override
    public int getYOffset() {
        return 20;
    }
}
